package tomoto.util;

import java.util.Collection;

/**
 * Helper utility to operate collections.
 * 
 * @author Tomoto Shimizu Washio
 * 
 */
public class CollectionUtil {
	@Deprecated
	private CollectionUtil() {}

	/**
	 * Adds an element to a collection if it is not yet an member of the
	 * collection.
	 * 
	 * @param <T> Element type
	 * @param collection collection to add to
	 * @param o object to add
	 */
	public static <T> void addOnce(Collection<T> collection, T o) {
		if (!collection.contains(o)) {
			collection.add(o);
		}
	}
	
}
